package com.peixunp.dao.impl;

import java.util.List;

import com.peixunp.bean.Place;
import com.peixunp.dao.PlaceDao;
import com.peixunp.util.Constants;

import finaler.db.AbstractBaseDao;

public class PlaceDaoImpl extends AbstractBaseDao<Place> implements PlaceDao {

	@Override
	protected boolean isDebug() {
		return Constants.ISDEBUG;
	}
	
	
	@Override
	protected Class<Place> getEntityClass() {
		return Place.class;
	}
	/**
	 * 获得所有省会
	 */
	@Override
	public List<Place> getProvinceList() throws Exception {
		String sql = "select id,pname from place where parent = '0' and id<>'429'";
		return super.findBySqlToBeanList(sql);
	}
	/**
	 * 通过省会id,获得所有城市
	 */
	@Override
	public List<Place> getCityList(int provinceId) throws Exception {
		String sql = "select id,pname from place where parent = '"+provinceId+"'";
		return super.findBySqlToBeanList(sql);
	}

}
